package main

import (
	"fmt"
	"strings"
)

func main() {
	s := "hello world"
	// content
	fmt.Println(strings.Contains(s, "hello"), strings.Contains(s, "!"))
	fmt.Println(strings.Index(s, "o"), strings.Index(s, "-"))
	// check
	fmt.Println(strings.HasPrefix(s, "he"), strings.HasPrefix(s, "lo"))
	fmt.Println(strings.HasSuffix(s, "ld"), strings.HasSuffix(s, "wo"))
	// trim
	fmt.Println(strings.TrimPrefix(s, "he"), strings.TrimSuffix(s, "ld"))
	fmt.Println(strings.TrimSpace("  hahaha~  "))
	// split & join
	s2 := "1-2-3-4-5"
	fmt.Println(s2)
	parts := strings.Split(s2, "-")
	fmt.Println(parts)
	s3 := strings.Join(parts, "+")
	fmt.Println(s3)
	// compare
	fmt.Println(strings.EqualFold("Hello World", s))
	// length
	fmt.Println(strings.Count(s, "")-1, len(s))
	// replace
	fmt.Println(strings.Replace("hahah", "h", "s", -1))
}
